﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;
using System.IO;
using System.Text;
namespace IHISCETeim.Web.MachineSys.UserModel
{
    public partial class AlermUClaimDemageListClear : PageBase
    {
        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.查看 };
            }
        }
        protected override string DWZRef
        {
            get { return "AlermUClaimDemageList"; }
        }


        protected void Page_Load(object sender, EventArgs e)
        {
            if (GetRequestValue<string>("ajaxmethod", "") == "clear")
            {
                clear();
            }
        }

        protected void clear()
        {
            try
            {
                string FolderPath = "/upload/uploadexcel/";
                string FileNamePath = IHISCETeim.Library.FileUploadHelper.UpLoadExcel(FolderPath);

                DataTable dt = NPOIHelper.ImportExcel(FileNamePath);
                foreach (DataRow dr in dt.Rows)
                {
                    string AgentName = dr["代理商"].ToString();
                    string SerialNumber = dr["机号"].ToString();
                    string ClaimsNumber = dr["索赔单号"].ToString();
                    string ItemCode = dr["物料号"].ToString();
                    string remark = dr["处理建议"].ToString() + "  " + dr["处理理由"].ToString();
                    string InQuantity = dr["数量"].ToString();

                    UClaimDemageController.ClearInWillAlerm(AgentName, SerialNumber, ClaimsNumber, ItemCode, remark, InQuantity);

                }
                SuccessAlertJson("清理成功");
            }
            catch (Exception exc)
            {
              //  ErrorJson(exc.Message);
            }

           
        }
    }
}